package day17;

import java.util.Random;

public class GetIn {
    public void get() throws InterruptedException {
        Random rd=new Random();
        String name=Thread.currentThread().getName();
        for (int i=1;i<=10;i++){
            int n=rd.nextInt(10)+1;
            System.out.println(name+n+"开始进山洞");
            for (int j=3;j>=1;j--){
                Thread.sleep(1000);
                System.out.println("剩余"+j+"S");
            }
            System.out.println(name+n+"开始出山洞");
        }
    }
    public static void main(String[] args) {
        GetIn gi=new GetIn();
        new Thread(()->{
            try {
                gi.get();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        },"李四").start();
    }
}

